package com.xc.h05.controller.changlongfei;

import com.xc.h05.entity.CoursetalkCLFV;
import com.xc.h05.service.changlongfei.VCoursetalkService;
import com.xc.h05.util.R;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/coursetalk")
public class VCoursetalkController {
    @Autowired
    private VCoursetalkService vCoursetalkService;

    @GetMapping("/getCoursetalkByPage")
    public R getCoursetalkByPage(int pageNum, int pageSize, CoursetalkCLFV coursetalkCLFV) {
        return R.ok(vCoursetalkService.getCoursetalkByPage(pageNum, pageSize, coursetalkCLFV));
    }
//   删除
    @DeleteMapping("/deleteByPrimaryKey")
    public R deleteByPrimaryKey(Long id) {
        int i = vCoursetalkService.deleteByPrimaryKey(id);
        if (i == 0) {
            return R.ok("删除失败");
        }else {
            return R.ok("删除成功");
        }
    }
//    批量删除
    @DeleteMapping("/deleteCoursetalkBatch")
    public R deleteCoursetalkBatch(@RequestParam Long[] ids) {
        int i = vCoursetalkService.deleteCoursetalkBatch(ids);
        if (i == 0) {
            return R.ok("删除失败");
        }else {
            return R.ok("删除成功");
        }

    }

}
